package com.hrs.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.hrs.enity.vo.EnumVo;
import lombok.Getter;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;

/**
 * @author 计算机系 ITAEM 摆渡人
 * @description
 * @date 2022/11/20 22:42
 */
@Getter
public enum Role {
    HUMAN_RESOURCES_SPECIALIST(1,"人事专员"),
    HR(2,"人事经理"),
    PAYLOAD_SPECIALIST(3,"薪酬经理"),
    COMPENSATION_MANAGER(4,"薪酬专员"),
    ADMIN(5,"管理员");

    @EnumValue
    private final Integer code;
    @JsonValue
    private final String display;

    Role(Integer code, String display) {
        this.code = code;
        this.display = display;
    }

    public static List<EnumVo> getEnumVos() {
        List<EnumVo> enumVos = new ArrayList<>();
        EnumSet.allOf(Role.class)
                .forEach(role -> {
                    EnumVo enumVo = new EnumVo();
                    enumVo.setCode(role.code);
                    enumVo.setDisplay(role.display);
                    enumVos.add(enumVo);
                });

        return enumVos;
    }
}
